<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>垂直居中</title>
    <style>
        .main {
            height: 100px;
            background-color: lightskyblue;
        }

        .search {
            margin-left: 20px;
        }

        div.search {
            display: inline-block;
            vertical-align: middle;
        }

        div.main::after {
            content: "";
            display: inline-block;
            background-color: gold;
            height: 100%;
            /*不写也行*/
            width: 0;
            /*width: 10px;*/
            vertical-align: middle;
        }

    </style>
</head>
<body>

<div class="main">
    <div class="search">
        <form action="">
            <input type="text" placeholder="请输入...">
            <button>搜索</button>
        </form>
    </div>
</div>


</body>
</html>